using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Drawing.Text;
using System.Text;
using System.Windows.Forms;
using RideMe.Core;
using ICSharpCode.TextEditor;
using System.Xml;
using ICSharpCode.TextEditor.Document;
using System.IO;

namespace RideMe.Presentation
{
    public partial class TextEditorOptionsPanel : UserControl 
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="T:TextEditorOptionsPanel"/> class.
        /// </summary>
        public TextEditorOptionsPanel()
        {
            InitializeComponent();
            FillFontCombo();
        }

        /// <summary>
        /// Gets or sets a value indicating whether [show line numbers].
        /// </summary>
        /// <value><c>true</c> if [show line numbers]; otherwise, <c>false</c>.</value>
        public bool ShowLineNumbers
        {
            get { return showLineNumbersCheckBox.Checked; }
            set { showLineNumbersCheckBox.Checked = value; }
        }

        /// <summary>
        /// Gets or sets the editor font family.
        /// </summary>
        /// <value>The editor font family.</value>
        public string EditorFontFamily
        {
            get { return this.fontComboControl.Text; }
            set { this.fontComboControl.Text = value; }
        }

        public bool ShowSpaces
        {
            get { return showSpaces.Checked; }
            set { showSpaces.Checked = value; }
        }

        public bool ShowTabs
        {
            get { return showTabs.Checked; }
            set { showTabs.Checked = value; }
        }

        public bool ShowEOL
        {
            get { return showEOL.Checked; }
            set { showEOL.Checked = value; }
        }

		public bool ConvertTabsToSpaces
		{
			get { return convertTabsToSpaces.Checked; }
			set { convertTabsToSpaces.Checked = value; }
		}

        public bool EnableFolding
        {
            get { return enableFoldingCheckBox.Checked; }
            set { enableFoldingCheckBox.Checked = value; }
        }


        /// <summary>
        /// Gets or sets the size of the editor font.
        /// </summary>
        /// <value>The size of the editor font.</value>
        public float EditorFontSize
        {
            get { return float.Parse(this.sizeComboBox.Text); }
            set { this.sizeComboBox.Text = value.ToString(); }
        }

        public Color ModelColor
        {
            get { return modelsColorComboBox.SelectedColor; }
            set { modelsColorComboBox.SelectedColor = value; }
        }

        public Color ViewColor
        {
            get { return viewsColorComboBox.SelectedColor; }
            set { viewsColorComboBox.SelectedColor = value; }
        }

        public Color ControllerColor
        {
            get { return controllersColorComboBox.SelectedColor; }
            set { controllersColorComboBox.SelectedColor = value; }
        }

        public Color TestsColor
        {
            get { return testsColorComboBox.SelectedColor; }
            set { testsColorComboBox.SelectedColor = value; }
        }

        /// Populates the font combo box with all installed fonts.
        /// </summary>
        private void FillFontCombo()
        {
            fontComboControl.Items.Clear();
            InstalledFontCollection installedFonts = new InstalledFontCollection();
            foreach (FontFamily family in installedFonts.Families)
            {
                fontComboControl.Items.Add(family.Name);
            }
        }

   
    }
}
